package com.med.controller;

import com.med.entity.GoodsOrderDO;
import com.med.entity.GoodsOrderDetailsDO;
import com.med.entity.MedicineOrderDO;
import com.med.entity.MedicineOrderDetailsDO;
import com.med.service.impl.OrderService;
import com.med.vo.OrderVO;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * @BelongsProject: internet-based-healthcare01
 * @BelongsPackage: com.med.controller
 * @Author: WWJ
 * @CreateTime: 2025-08-18 16:28
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
@RefreshScope
@RequestMapping("/order")
public class OrderController extends BaseController {
    @Autowired
    private OrderService orderService;

    //分页查找药品订单
    @RequestMapping("/list")
    public TableDataInfo listUser(OrderVO orderVO) {
        System.out.println("====================" + orderVO);
        startPage();
        List<MedicineOrderDO> list = orderService.queryMedicineOrder(orderVO);
        return getDataTable(list);
    }

    //分页查找商品订单
    @RequestMapping("/goodslist")
    public TableDataInfo listGoods(OrderVO orderVO) {
        System.out.println("====================" + orderVO);
        startPage();
        List<GoodsOrderDO> goodsOrderDOS = orderService.queryGoodOrder(orderVO);
        return getDataTable(goodsOrderDOS);
    }

    //查询药品订单的详细信息
    @RequestMapping("/mdetail")
    public TableDataInfo queryMedicineOrder(OrderVO orderVO) {
        System.out.println("====================" + orderVO);
        startPage();
        List<MedicineOrderDetailsDO> dos = orderService.queryMedicineOrderDetails(orderVO);
        return getDataTable(dos);
    }

    //查询药品订单的详细信息
    @RequestMapping("/gdetail")
    public TableDataInfo queryGoodsOrder(OrderVO orderVO) {
        System.out.println("====================" + orderVO);
        startPage();
        List<GoodsOrderDetailsDO> goodsOrderDetailsDOS = orderService.queryGoodsOrderDetails(orderVO);
        return getDataTable(goodsOrderDetailsDOS);
    }
}
